//
//  MyViewController.m
//  大轮胎
//
//  Created by 朱永超 on 2017/3/16.
//  Copyright © 2017年 zyc. All rights reserved.
//

#import "MyViewController.h"
#import "MyTableViewCell.h"
@interface MyViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    NSArray*array;
    NSArray*arraytxt;
}
@property(nonatomic,strong)UITableView*table;

@end

@implementation MyViewController
//懒加载表格
-(UITableView*)table
{
    if (!_table) {
        _table=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
        _table.delegate=self;
        _table.dataSource=self;
        _table.tableFooterView = [[UIView alloc]init];
    }
    return _table;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    //设置标题
    self.navigationItem.title = @"我的资料";
    //设置导航标题字体大小和颜色
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17],
        NSForegroundColorAttributeName:[UIColor whiteColor]}];
    //设置背景颜色
    self.view.backgroundColor = [UIColor whiteColor];
    
    //添加表格
    [self.view addSubview:self.table];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 8;
}

//cell内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString*cellid=@"cell";
    MyTableViewCell*cell=[tableView cellForRowAtIndexPath:indexPath];
    if (!cell) {
        cell=[[MyTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellid];
    
           }
    
    if (indexPath.row==0) {
        
        cell.image.image=[UIImage imageNamed:@"2"];
        cell.label.text=@"请登录/";
        cell.backgroundColor=[UIColor colorWithRed:0.986 green:0.497 blue:0.115 alpha:0.850];
    }
    else
    {
        //设置图标数组
        array=[[NSArray alloc]initWithObjects:@"648A75A26FED2078B8D311AFB8802AE8",
               @"ETC缴费",@"通知存单",@"理财",@"贷款",@"有线电视",@"手机充值",@"更多", nil];

        cell.imageView.image=[UIImage imageNamed:array[indexPath.row]];
        
        cell.textLabel.font =[UIFont systemFontOfSize:15];
        
        //设置标题数组
        arraytxt = [[NSArray alloc]initWithObjects:@"我的订单",@"我的购物车",@"我的优惠券",@"我的胎币",@"胎币兑换",@"我的消息",@"在线客服",@"设置", nil];
        cell.textLabel.text =arraytxt[indexPath.row];
    
    }
    
    return cell;
}

//表格高度
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==0) {
        return 140;
    }
    else{
        return 50;
    }
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}

@end
